#!/usr/bin/perl
use Net::Delicious;
use Log::Dispatch::Screen;
#use LWP::UserAgent;
#use HTTP::Request;
#use URI::URL qw(url);
#use DateTime;
#use DateTime::Format::W3CDTF;

my $cfg = new Config::Simple("$ENV{HOME}/freshnious.ini");
if ($cfg->param("debug")) {
   printf("logging in as '%s'\n", $cfg->param("user"));
   printf("logging in with pswd '%s'\n", $cfg->param("pswd"));
}

my $del = Net::Delicious->new ( $cfg );

# first arg = mailicious+other+tags
# second arg = url description
# third arg = url
my($tags, $description, $url) = @ARGV;
my @tags = split(/\+/, $tags);


$del->add_post({ 'url' => $url,
      'description' => $description,
      'tags' => join(" ", @tags),
      });
